package com.pdg.dungeondelver.engine;

import java.util.Iterator;
import java.util.Map;

import com.pdg.dungeondelver.configuration.Configuration;
import com.pdg.dungeondelver.configuration.Descriptor;

public class AtlasColumn extends DescriptoredHashMap<Integer,AtlasCell> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6257981354040483198L;
	private Atlas atlas;
	
	public AtlasColumn(Atlas parent){
		super(new Descriptor());
		setAtlas(parent);
	}

	private void setAtlas(Atlas parent) {
		atlas = parent;
	}
	public Atlas getAtlas(){
		return atlas;
	}
	public Configuration getConfiguration(){
		return getAtlas().getConfiguration();
	}
	public Integer getColumnId(){
		Iterator<Map.Entry<Integer,AtlasColumn>> iterator = getAtlas().entrySet().iterator();
		while(iterator.hasNext()){
			Map.Entry<Integer,AtlasColumn> entry = iterator.next();
			if(entry.getValue().equals(this)){
				return entry.getKey();
			}
		}
		return null;
	}
}
